#include <iostream>
using namespace std;


int main()
{
	string str;
	cin >> str;
	int count = 0;
	if (str.length() == 1)
	{
		cout << 0 << endl;
		return 0;
	}

	for (int i = 0; i < str.length(); ++i)
	{
		if (str[i] == str[i + 1])
		{
			++count;
			++i;
		}
		else
		{
			if (str[i] != '?' && str[i + 1] != '?')
				continue;
			else
			{
				++count;
				++i;
			}
		}
	}
	cout << count << endl;

	return 0;
}